count(X=Y)=count(X<=Y)-count(X<=Y-1)